#!/bin/sh
#
# 简单写一下脚本的功能。
#
#
#

if [ $# -eq 0 ]; then 

	echo "1 for COREAD"
	echo "2 for QUICKVIEW"
	echo "3 for COMMON"
	read readmode

	while [ $readmode != "1" ] && [ $readmode != "2" ] && [ $readmode != "3" ];
	do
		echo "1 for COREAD"
		echo "2 for QUICKVIEW"
		echo "3 for COMMON"
		read readmode
	done

	sed -e "/^readmode/d" config >config.tmp
	mv config.tmp config

	if [ $readmode -eq "1" ]; then 
		echo "readmode=COREAD" >>config
	fi

	if [ $readmode -eq "2" ]; then 
		echo "readmode=QUICKVIEW" >>config
	fi
	if [ $readmode -eq "3" ]; then 
		echo "readmode=COMMON" >>config
	fi

fi

echo "请输入本书的分类，q 退出"

echo "-------"

grep "\[" ../index_booklist.md |sed -e "/center/d" |awk -F\]  '{print $1}' |sed -e "s/\[//g"

echo "-------"

read booklist

if [ $booklist == "q" ] || [ $booklist == "Q" ];then 
	exit
fi


echo $booklist >>BOOKLIST.md

